home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar Extras 3
/
Ex3side1.d64
/
i-menu v2 source
< prev
next >
Wrap
Text File
|
2022-08-28
|
5KB
|
502 lines
; * * * * INSTANT MENU * * * *
;by Rick Nash
;This program will create a CRSR/RETURN menu
;from one sys
;sys,#items(+64 no screen save),x,y,box col+(64 double space)(+128 cancel),high,text,list$
.org $c800
.obj "i-menu v2 c800"
jmp over'to'the'menu
jmp screen'stash'enter
jmp screen'restore'enter
over'to'the'menu ldx #6
stx numbers'to'get
jsr get'number
lda number
sta number+8
and #15
sta number
bit number+8
bvs check'x'range
bmi check'x'range
lda #4
sta screen
jsr screen'stash
check'x'range lda number+1
bne +
jsr x'out
+ lda number+3
bne +
jsr x'out
+ jsr line'links
lda #0
sta max
ldx number+2
ldy number+1
clc
jsr $fff0
jsr old'rom'patch
lda number+5
sta 646
lda number
sta digit
- jsr get'string
dec digit
bne -
beq +
menu'jump jmp menu
+ bit number+3
bmi menu'jump
box ldx number+2
dex
ldy number+1
dey
clc
jsr $fff0
jsr old'rom'patch
lda number+3
sta 646
lda #176
jsr $ffd2
- lda #96
jsr $ffd2
lda 211
cmp max
bne -
lda #174
jsr $ffd2
inc 214
lda number
sta digit
line ldx number+1
dex
stx 211
jsr 58732
jsr old'rom'patch
lda #125
jsr $ffd2
lda max
sta 211
jsr 58732
jsr old'rom'patch
lda #125
jsr $ffd2
bit number+3
bvc after'double
lda digit
cmp #1
beq after'double
inc 214
ldx number+1
dex
stx 211
jsr 58732
jsr old'rom'patch
lda #171
jsr $ffd2
- lda #96
jsr $ffd2
lda 211
cmp max
bne -
lda #179
jsr $ffd2
after'double inc 214
dec digit
bne line
lda number+1
sta 211
dec 211
jsr 58732
jsr old'rom'patch
lda #173
jsr $ffd2
- lda #96
jsr $ffd2
lda 211
cmp max
bne -
lda #189
jsr $ffd2
menu lda #0
sta item
sta current
sta previous
ldx number+2
ldy #0
clc
jsr $fff0
jsr old'rom'patch
lda number+4
sta digit
jsr highlight'routine
get'key jsr $ffe4
beq get'key
cmp #17
beq crsr'down
cmp #145
beq crsr'up
cmp #13
beq quit
bne get'key
quit lda item
clc
adc #49
sta 631
lda #1
sta 198
bit number+8
bvs +
bmi +
lda #4
sta screen
jsr screen'restore
+ jsr line'links
rts
crsr'up lda item
sta previous
sec
sbc #1
bpl +
ldx number
dex
txa
+ sta item
jsr highlight
jmp get'key
crsr'down lda item
sta previous
clc
adc #1
cmp number
bne +
lda #0
+ sta item
jsr highlight
jmp get'key
highlight lda previous
bit number+3
bvc +
asl
+ clc
adc number+2
bit number+3
tax
ldy #0
jsr $fff0
jsr old'rom'patch
lda number+5
sta digit
jsr highlight'routine
lda item
bit number+3
bvc +
asl
+ clc
adc number+2
tax
ldy #0
jsr $fff0
jsr old'rom'patch
lda number+4
sta digit
jsr highlight'routine
rts
highlight'routine ldy number+1
- lda (209),y
eor #128
sta (209),y
lda digit
sta (243),y
iny
cpy max
bne -
rts
;**** get number from BASIC ****
get'number ldx #0
stx current'number
- jsr $aefd
jsr $ad8a
jsr $b7f7
lda $14 ; got it!
ldx current'number
sta number,x
inc current'number
dec numbers'to'get
beq +
bne -
+ rts
;***** get string from BASIC ****
get'string jsr $aefd
jsr $ad9e
jsr $b6a3
ldx $22
ldy $23
stx 251
sty 252
cmp #41
bcc +
lda #40
+ sta string'length
lda number+1
sta 211
jsr 58732
jsr old'rom'patch
ldy #0
- lda (251),y
jsr $ffd2
iny
cpy string'length
bne -
lda 211
cmp max
bcc +
sta max
+ inc 214
bit number+3
bvc +
inc 214
+ jsr 58732
jsr old'rom'patch
lda max
cmp #41
bcc +
jsr x'out
+ lda 214
cmp #24
bcc +
jsr x'out
+ rts
;**** Line Links ****
line'links ldy #24
- lda 217,y
ora #128
sta 217,y
dey
bpl -
rts
;**** wait ****
wait lda 53265
bpl wait
rts
;**** SCREEN STASH ****
screen'stash ldy screen
cpy #9 ; ahem! there are only 9 screens (0-8)
bcc +
rts
+ sei
ldx #0
lda 1
sta temp
stx 1
lda screens,y
stx 253
sta 254; dest screen
lda 648
sta 252; source screen
ldy #0
sty 251
;begin copying
- lda (251),y
sta (253),y
iny
bne -
inx
inc 254
inc 252
cpx #4
bne -
ldx #0
lda #>55296
sta 252
- dec 1
lda (251),y
inc 1
sta (253),y
iny
bne -
inc 252
inc 254
inx
cpx #4
bne -
lda temp
sta 1
cli
lda 53280
ldy number
sta border,y
lda 53281
sta background,y
rts
screen'restore ldy screen
cpy #9 ; ahem! there are only 9 screens (0-8)
bcc +
rts
/ lda 53265
bpl -
sei
ldx #0
lda 1
sta temp
stx 1
lda screens,y
stx 253
sta 254; source screen
lda 648
sta 252; dest screen
ldy #0
sty 251
;begin copying
- lda (253),y
sta (251),y
iny
bne -
inx
inc 254
inc 252
cpx #4
bne -
ldx #0
lda #>55296
sta 252
- lda (253),y
dec 1
sta (251),y
inc 1
iny
bne -
inc 252
inc 254
inx
cpx #4
bne -
lda temp
sta 1
cli
ldy number
lda border,y
sta 53280
lda background,y
sta 53281
rts
x'out lda number+3
ora #128
sta number+3
rts
screen'stash'enter ldx #1
stx numbers'to'get
jsr get'number
lda number
sta screen
jmp screen'stash
screen'restore'enter ldx #1
stx numbers'to'get
jsr get'number
lda number
sta screen
jmp screen'restore
old'rom'patch lda 210
sec
sbc 648
clc
adc #$d8
sta 244
lda 209
sta 243
rts
device .byt 8
numbers'to'get .buf 1
current'number .buf 1
string'len .buf 2
number .buf 9
digit .byt 0
max .byt 0
temp .byt 0
current .byt 0
previous .byt 0
item .byt 0
flag .byt 0
string'length .buf 2
screen .byt 0
screens .byt $a0,$a8,$b0,$b8,$d0,$d8,$e0,$e8,$f0
border .buf 9
background .buf 9